<?php
/**
 * Template Name: KnowledgeCenter - Landing
 * Description: The landing page for Knowledge Center
 *
 * @package ManterRealty
 * 
 */

get_header(); ?>
		
        <div class="kc_wrap kc_landing">
        	<?php if ( have_posts() ) : ?>
            	<?php while ( have_posts() ) : the_post(); ?>

					<?php 
					the_content();
					
					$knowledgecenter = url_to_postid($root.'/knowledge-center');
					$pages = get_pages('child_of='.$knowledgecenter.'&parent='.$knowledgecenter.'&sort_column=menu_order&sort_order=asc');
					
					?>
					
                    <div id="KC_Buyers" class="kc_landing_image">
                    	<a href="<?php echo $root; ?>/knowledge-center/buyers">
							<?php
								$vals = get_post_custom_values('buyers_image',$page->ID);
								$buyersImageArray = wp_get_attachment_image_src($vals[0], 'full');
								echo('<img src="'.$buyersImageArray[0].'" />');
							?>
							<span class="label">Buyers &raquo;</span>
                        </a>
                    </div>
                    <div id="KC_Sellers" class="kc_landing_image">
                    	<a href="<?php echo $root; ?>/knowledge-center/sellers">
                            <?php
								$vals = get_post_custom_values('sellers_image',$page->ID);
								$sellersImageArray = wp_get_attachment_image_src($vals[0], 'full');
								echo('<img src="'.$sellersImageArray[0].'" />');
							?>
                            <span class="label">Sellers &raquo;</span>
                        </a>
                    </div>
                    <div id="KC_Seniors" class="kc_landing_image">
                    	<a href="<?php echo $root; ?>/knowledge-center/seniors">
							<?php
								$vals = get_post_custom_values('seniors_image',$page->ID);
								$seniorsImageArray = wp_get_attachment_image_src($vals[0], 'full');
								echo('<img src="'.$seniorsImageArray[0].'" />');
							?>
                            <span class="label">Seniors &raquo;</span>
                        </a>
                    </div>
                    <div id="KC_REOwned" class="kc_landing_image">
                    	<a href="<?php echo $root; ?>/knowledge-center/real-estate-owned">
                            <?php
								$vals = get_post_custom_values('real_estate_owned_image',$page->ID);
								$reoImageArray = wp_get_attachment_image_src($vals[0], 'full');
								echo('<img src="'.$reoImageArray[0].'" />');
							?>
                            <span class="label">Real Estate Owned &raquo;</span>
                        </a>
                    </div>
                    <div id="KC_ShortSale" class="kc_landing_image">
                    	<a href="<?php echo $root; ?>/knowledge-center/short-sale">
                            <?php
								$vals = get_post_custom_values('short_sale_image',$page->ID);
								$shortSaleImageArray = wp_get_attachment_image_src($vals[0], 'full');
								echo('<img src="'.$shortSaleImageArray[0].'" />');
							?>
                            <span class="label">Short Sale &raquo;</span>
                        </a>
                    </div>
                    
                    <div class="clear"></div>
                    
                    <div class="kc_more_resources">
                    	<div class="kc_more_resources_pad">
                        	<span class="label">More Resources:</span>
                            <a href="<?php echo $root; ?>/knowledge-center/frequently-asked-questions">Frequently Asked Questions</a>
                            <span class="pipe">|</span>
                            <a href="<?php echo $root; ?>/knowledge-center/printables-media">Printables &amp; Media</a>
                            <span class="pipe">|</span>
                            <a href="<?php echo $root; ?>/knowledge-center/online-tools">Online Tools</a>
                        </div>
                    </div>
				<?php endwhile; ?>
             <?php endif; ?>
        </div>

<?php get_footer(); ?>